package com.hua.designpattern.creational.builder;

import java.util.List;

public class Meal {
	private List<Drink> drinks;

	private List<Burger> burgers;

	public double totalPrice() {
		double totalPrice = 0;

		for (Drink item : drinks) {
			totalPrice += item.price();
		}
		for (Burger item : burgers) {
			totalPrice += item.price();
		}
		return totalPrice;
	}

	public List<Drink> getDrinks() {
		return drinks;
	}

	public void setDrinks(List<Drink> drinks) {
		this.drinks = drinks;
	}

	public List<Burger> getBurgers() {
		return burgers;
	}

	public void setBurgers(List<Burger> burgers) {
		this.burgers = burgers;
	}

	@Override
	public String toString() {
		StringBuffer names = new StringBuffer("[ ");
		for (Drink item : drinks) {
			names.append(item.name() + ", ");
		}
		for (Burger item : burgers) {
			names.append(item.name() + ", ");
		}
		names.append(" ]");
		return super.toString() + names;
	}

}
